/*
 * @Author: wrh123 482597539@qq.com
 * @Date: 2024-01-18 21:39:48
 * @LastEditors: wrh123 482597539@qq.com
 * @LastEditTime: 2024-01-19 08:10:07
 * @FilePath: /vue-admin/src/api/staff.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import service from '@/utils/request'

// 员工分页查询
export function getStaffPage(params) {
    return service({
        url: '/employee/page',
        method: 'get',
        params
    })
}

// 根据员工ID删除员工
export function deleteStaff(id) {
    return service({
        url: `/employee/delateEmpByid?id=${id}`,
        method: 'delete'

    })
}

// 新增员工
export function addStaff(data) {
    return service({
        url: '/employee/addEmp',
        method: 'post',
        data
    })
}

// 修改员工信息
export function updateStaff(data) {
    return service({
        url: '/employee/update',
        method: 'put',
        data
    })
}

// 修改员工启用禁用
export function updateStaffStatus(data) {
    return service({
        url: '/employee/updateStatus',
        method: 'PUT',
        data
    })
}

//员工回显
export function getStaffPageEdit(id) {
    return service({
        url: `/employee/echo?id=${id}`,
        method: 'get'
    })
}

// 用户分页查询
export function getUserPage(params) {
    console.log(params)
    return service({
        url: '/userEasy/selectPageTbUser',
        method: 'get',
        params
    })
}

// 根据id删除用户
export function deleteUser(data) {
    return service({
        url: 'userEasy/deleteTbUserById/' + data,
        method: 'delete',
    })
}

// 查看身份证正面照片
export function getIdCardFront(data) {
    return service({
        url: 'userEasy/selectTbUserFacePhoto/' + data,
        method: 'get',
    })
}

// 查看身份证反面照片
export function getIdCardBack(data) {
    return service({
        url: 'userEasy/selectTbUserBackPhoto/' + data,
        method: 'get',
    })
}

// 优惠卷分页查询
export function getCouponList(params) {
    return service({
        url: '/coupon/couponPage',
        method: 'get',
        params
    })
}

// 删除优惠卷
export function deleteCoupon(data) {
    return service({
        url: '/coupon/deleteCouponById/' + data,
        method: 'DELETE',
    })
}

// 回显随机优惠卷
export function randomCoupon() {
    return service({
        url: '/coupon/couponCodeNumber',
        method: 'get',
    })
}

// 确定新增优惠卷
export function submitAddCoupon(data) {
    return service({
        url: '/coupon/insertCoupon',
        method: 'post',
        data
    })
}

// 修改用户标签
export function ModifyLabels(data) {
    return service({
        url: `userEasy/updateTbUserTagName/${data.id}/${data.tagName}`,
        method: 'put',
    })
}

// 修改账号标签
export function ModifyAccountLabels(data) {
    return service({
        url: `account/updateTbAccountPassword`,
        method: 'put',
        data
    })
}

// 修改短信通知手机号
export function updatePhone(data) {
    return service({
        url: `employee/updateEmpEcho`,
        method: 'put',
        data
    })
}

// 获取各类型手机号
export function getPhone() {
    return service({
        url: `employee/selectByIdName`,
        method: 'get',
    })
}


// 回显用户标签信息
export function getUserLabels(id) {
    return service({
        url: `userEasy/selectByIdAccountTagName/${id}`,
        method: 'get',
    })
}

// 回显账号标签信息
export function getAccountLabels(id) {
    return service({
        url: `account/selectTbAccountTagName/${id}`,
        method: 'get',
    })
}

// 修改员工的密码
export function updatePassword(data) {
    return service({
        url: `/employee/update`,
        method: 'put',
        data
    })
}

// 查询email页面
export function getEmailListArr(params) {
    return service({
        url: `/userEasy/selectPageTbUserContact`,
        method: 'get',
        params
    })
}

// 删除email
export function deleteEmail(data) {
    return service({
        url: `/userEasy/deleteTbUserContact/${data}`,
        method: 'delete',
        data
    })
}

// 回复
export function replyEmail(data) {
    return service({
        url: `/userEasy/replyUserTextMessage`,
        method: 'post',
        data
    })
}